package top.yesz.home.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>TODO</p>
 *
 * @author YsEz
 * @version V1.0.0
 * @date 2022/5/27 15:46
 */

@RestController
@RequestMapping("/h2")
public class Hello2 {

    @GetMapping("/h1")
    public String h1() {
        System.out.println("Hello springboot");
        return "hello,this is a springboot demo！~";
    }

    @GetMapping("/h2")
    public String h2(@RequestParam("username") String username, @RequestParam("password") String password) {
        String result = "username:" + username + ",password:" + password;
        if ("123".equalsIgnoreCase(password) && "zz".equalsIgnoreCase(username)) {
            System.out.println("恭喜你登陆了");
            return (result + "---恭喜你登陆了");
        } else {
            System.out.println("登陆失败");
            return (result + "---登陆失败");
        }
    }
}